package com.mc.lp.database.dao.impl;

import java.util.List;

import org.springframework.util.CollectionUtils;

import com.mc.lp.database.dao.IEnvDAO;
import com.mc.lp.database.entity.EnvEntity;

public class EnvDAOImpl extends AbstractGenericHibernateDAO<EnvEntity, Long, IEnvDAO> implements IEnvDAO{
	private static final long serialVersionUID = 1L;
	public String getEnvironment(){
		List<EnvEntity> environmentEntities= findAll();
		if(!CollectionUtils.isEmpty(environmentEntities)){
			EnvEntity entity= environmentEntities.get(0);
			return entity.getValue();
		}
		throw new NullPointerException("ENV has not been set in database, kindly set the environment first. see DB_ENV table");
	}
}
